package com.equipment.system.web.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * ${DESCRIPTION}
 *
 * @author 杨凯
 * @create 2018-03-30 13:55
 **/
@Controller
@RequestMapping("/mail")
public class MailController {

	@Autowired
	private MailSender mailSender;


	@GetMapping("/send")
	public void sendSimpleMail() throws Exception {
		SimpleMailMessage message = new SimpleMailMessage();
		message.setFrom("494040246@qq.com");
		message.setTo("494040246@qq.com");
		message.setSubject("主题：系统异常信息处理");
		message.setText("测试邮件内容");
		mailSender.send(message);
		System.out.println("发送成功");
	}
}
